﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace reminder_to_stand_up_and_take_a_break_from_sitting_for_a_long_time
{
    /// <summary>
    /// Window1.xaml 的交互逻辑
    /// </summary>
    public partial class main : Window
    {
        public main()
        {
            InitializeComponent();
        }

        public ellipse ellipsemain;

        private void Button_Click(object sender, RoutedEventArgs e)
        {

            if (ellipsemain == null)
            {
                ellipsemain = new ellipse(this);
            }
            Timer.workTime = TimeSpan.FromMinutes(int.Parse(workTime.Text));
            Timer.rest = TimeSpan.FromMinutes(int.Parse(restTime.Text));
            this.Hide();
            ellipsemain.Show();
            ellipsemain.labelTime.Foreground = Brushes.AliceBlue;
            ellipsemain.timing.Start();

            



            ellipsemain.Show();
            this.Hide();
            
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            //mainWindow.Close();
            Environment.Exit(0);
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (ellipsemain==null)
            {
                MessageBox.Show("计时开始后按这个按钮才能用作隐藏");
                return;
            }
            this.Hide();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Button_Click(sender,e);
        }
    }
}
